﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DAO;

public partial class TeacherDescription : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        
        if (!IsPostBack)
        {
            string teacherId = Request.Params["teacherId"].ToString();
            if (teacherId == null || teacherId.Length < 1)
            {
                return;
            }
            loadTeacherInfo(teacherId);
        }
    }

    private void loadTeacherInfo(string teacherId)
    {
        /*  select Name, Gender, Title, Degree, Major, Email, Phone, Address */

        TeacherDAO teacherDao = new TeacherDAO();

        DataRow dr = teacherDao.getTeacherAllInfoByID(teacherId).Tables[0].Rows[0];

        this.lbName.Text = dr["TeacherName"].ToString().Trim();
        this.lbAddress.Text = dr["Address"].ToString().Trim();
        this.lbTelephone.Text = dr["Telephone"].ToString().Trim();
        this.lbFax.Text = dr["Fax"].ToString().Trim();
        this.lbEmail.Text = dr["Email"].ToString().Trim();
        this.lbTitle.Text = dr["ProfessionalTitle"].ToString().Trim();
        this.lbDegree.Text = dr["EducationDegree"].ToString().Trim();
        this.lbResearchArea.Text = dr["ResearchArea"].ToString().Trim();
        this.lbJobBackground.Text = dr["JobBackgroud"].ToString().Trim();
        this.teacherImg.ImageUrl = dr["ImgPath"].ToString().Trim();
        this.lbSimpleDesc.Text = dr["TeacherDesc"].ToString();
        this.lbHonorDesc.Text = dr["HonorDesc"].ToString();
        this.lbTeachingDesc.Text = dr["TeachingDesc"].ToString();
        this.lbResearchDesc.Text = dr["ResearchDesc"].ToString();
    }


}
